package my12306.bean;

import java.io.Serializable;
import my12306.table.KeyValueItem;

/**
 * 乘车人信息
 *
 */
public class PassengerInfo implements Serializable {

    /**
     * 字段注释
     */
    private static final long serialVersionUID = 1L;
    // 乘车人信息
    private String idNo;    //身份证号码
    private String name;    //姓名
    private String phone;   //手机号
    private String seatType = "1"; // 座位类型, 硬座，硬卧。。
    private String tickType = "1"; // 车票类型，成人票，儿童票。。
    private String idType = "1";    // 证件类型
    private String idMode = "Y";    //实名制?
    private String fromStation; //发站
    private String toStation;  //发站
    private String startDate;   //出发日期
    private String rangDate;    //乘车时段

    /**
     * @return Returns the iD.
     */
    public String getID() {
        return idNo;
    }

    /**
     * @param iD The iD to set.
     */
    public void setID(String iD) {
        idNo = iD;
    }

    /**
     * @return Returns the name.
     */
    public String getName() {
        return name;
    }

    /**
     * @param name The name to set.
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return Returns the phone.
     */
    public String getPhone() {
        return phone;
    }

    /**
     * @param phone The phone to set.
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }

    /**
     * @return Returns the seatType.
     */
    public String getSeatType() {
        return seatType;
    }

    public String getSeatTypeName() {
        if (seatTypeKV != null) {
            return seatTypeKV.getKey();
        } else {
            return seatType;
        }
    }

    /**
     * @param seatType The seatType to set.
     */
    public void setSeatType(String seatType) {
        this.seatType = seatType;
    }
    KeyValueItem seatTypeKV;

    public void setSeatType(KeyValueItem seatType) {
        this.seatTypeKV = seatType;
        this.seatType=seatType.getValue();
    }

    /**
     * @return Returns the tickType.
     */
    public String getTickType() {
        return tickType;
    }

    /**
     * @param tickType The tickType to set.
     */
    public void setTickType(String tickType) {
        this.tickType = tickType;
    }

    /**
     * @return Returns the cardType.
     */
    public String getIDType() {
        return idType;
    }

    /**
     * @param cardType The cardType to set.
     */
    public void setIDType(String cardType) {
        this.idType = cardType;
    }

    /**
     * @return Returns the idMode.
     */
    public String getIdMode() {
        return idMode;
    }

    /**
     * "passengerTickets", "1,0,1,name,1,idno,phone,Y"
     *
     * @return
     */
    public String getTickets() {
        StringBuilder sb = new StringBuilder();
        sb.append(seatType).append(",")
                .append("0").append(",")
                .append("1").append(",")
                .append(name).append(",")
                .append("1").append(",")
                .append(idNo).append(",")
                .append(phone).append(",")
                .append("Y");
        return sb.toString();
    }

    /**
     * name,idtype,id
     *
     * @return
     */
    public String getSimpleText() {
        StringBuilder sb = new StringBuilder();
        sb.append(name).append(",").append(idType).append(",").append(idNo);
        return sb.toString();
    }

    /**
     * override 方法
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("UserInfo [ID=").append(idNo).append(", name=")
                .append(name).append(", phone=").append(phone)
                .append(", rangDate=").append(", startDate=")
                .append(", seatType=").append(seatType)
                .append(", tickType=").append(tickType).append(", cardType=")
                .append(idType).append(", idMode=").append(idMode)
                .append("]");
        return builder.toString();
    }

    /**
     * @return the startStation
     */
    public String getFromStation() {
        return fromStation;
    }

    /**
     * @param startStation the startStation to set
     */
    public void setFromStation(String startStation) {
        this.fromStation = startStation;
    }

    /**
     * @return the toStation
     */
    public String getToStation() {
        return toStation;
    }

    /**
     * @param toStation the toStation to set
     */
    public void setToStation(String toStation) {
        this.toStation = toStation;
    }

    /**
     * @return the startDate
     */
    public String getStartDate() {
        return startDate;
    }

    /**
     * @param startDate the startDate to set
     */
    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    /**
     * @return the rangDate
     */
    public String getRangDate() {
        return rangDate;
    }

    /**
     * @param rangDate the rangDate to set
     */
    public void setRangDate(String rangDate) {
        this.rangDate = rangDate;
    }
}
